package com.li.service;

import com.li.mapper.Course2Mapper;
import com.li.pojo.Course2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class Course2Service {
    @Autowired
    Course2Mapper course2Mapper;

    public Course2 queryCourse2(Course2 course2){
        return course2Mapper.queryCourse2(course2);
    }

    public boolean addCourse2(Course2 course2){
        if(course2Mapper.queryCourse2(course2)==null){
            course2Mapper.insertCourse2(course2);
            return  true;
        }
        return false;
    }

    public boolean deleteCourse2(Course2 course2){
        if(course2Mapper.queryCourse2(course2)!=null){
            course2Mapper.deleteCourse2(course2);
            return  true;
        }
        return false;
    }
    public boolean updateCourse2(Course2 course2){
        course2Mapper.updateCourse2(course2);
        return  true;
    }
    public List<Course2> allCourse2(){
        return course2Mapper.listCourse2();
    }
}
